﻿using Assistant.Properties;
using PortaCapena.OdooJsonRpcClient;
using PortaCapena.OdooJsonRpcClient.Models;
using Sunny.UI;
using System;
using WebAssistant.BusinessLogic;
using WebAssistant.Common;

namespace Assistant
{
    public class Shared
    {
        /// <summary>
        /// 版本 
        /// </summary>
        public readonly static string Version = Resources.Name + " " + Resources.Version;


        /// <summary>
        /// 端口
        /// </summary>
        public readonly static string Port = DataAccess.GetSettingByKey("assistant.port");

        public static OdooConfig odooConfig = new OdooConfig(
            apiUrl: DataAccess.GetSettingByKey("odoo.server.url"),
            dbName: DataAccess.GetSettingByKey("odoo.server.database"),
            userName: DataAccess.GetSettingByKey("odoo.server.user"),
            password: SecurityHelper.DecryptString(DataAccess.GetSettingByKey("odoo.server.password"), DataAccess.GetSettingByKey("odoo.key"))
            );

        public static OdooClient odooClient = new OdooClient(odooConfig);
    }
}
